package xcmg.device.dao.mapper.agent;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import xcmg.device.dao.entity.agent.ServiceBorrowOutDetailDO;
import xcmg.device.service.vo.agent.ServiceBorrowOutDetailVO;
import yb.ecp.fast.infra.infra.PageCommonVO;
import yb.ecp.fast.infra.infra.SearchCommonVO;

import java.math.BigDecimal;
import java.util.List;


/**
 * 服务借出单明细 Mapper
 *
 * @author huhuawei
 */
@Mapper
public interface ServiceBorrowOutDetailMapper {

    PageCommonVO list(SearchCommonVO<ServiceBorrowOutDetailVO> condition);

    List<ServiceBorrowOutDetailDO> queryList(ServiceBorrowOutDetailVO condition);

    int insert(ServiceBorrowOutDetailDO model);

    int merge(ServiceBorrowOutDetailDO model);
    
    int updateByPrimaryKeySelective(ServiceBorrowOutDetailDO bean);

    int deleteByPrimaryKeySelective(String id);
    
    int deleteByBorrowId(String borrowOutId);

    int updateStatus(@Param("status") Integer status, @Param("billId") String billId, @Param("materialsNo") String materialsNo, @Param("orgId") String orgId);

    List<ServiceBorrowOutDetailDO> selectByBorrowNo(@Param("borrowOutId") String borrowOutId);

    ServiceBorrowOutDetailDO selectByPrimaryKey(@Param("id") String id);

    int checkResaleQtyRollBackQty(@Param("borrowOutId") String borrowOutId);

    BigDecimal getRemainingQty(@Param("billId") String billId, @Param("materialsNo") String materialsNo);

    int getCount(@Param("borrowOutId") String borrowOutId);

    List<ServiceBorrowOutDetailDO> queryByServiceUserId(@Param("serviceStaffId") String serviceStaffId,
                                                        @Param("materialsNo") String materialsNo, @Param("orgId") String orgId,
                                                        @Param("id") String id);
}
